<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>创客英雄</title>
<script src="__TMPL__Portal/assets/js/jquery-3.1.1.min.js"></script>
<link href="__TMPL__Portal/assets/css/ckyx.css" rel="stylesheet">
<script src="__TMPL__Portal/assets/js/ckyx.min.js"></script>
<link href="__TMPL__Portal/assets/css/main.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="__TMPL__Portal/assets/css/demo.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__Portal/assets/css/component.css" />
<script src="__TMPL__Portal/assets/js/modernizr.custom.js"></script>
</head>

<body>
<!--header-->
<tc_include file="Portal:head" />
<div class="nav_box">
    <div class="container">
        <div class="row">
            <a class="logo col-md-2" href="index.html">
                <img src="__TMPL__Portal/assets/images/logo.png">
            </a>
			<tc_include file="Portal:nav" />
        </div>
    </div>
</div>

<!--banner_2-->
<div class="container banner_2">
	<img src="__TMPL__Portal/assets/images/zsxc.png">
</div>

<!--main3-->
<div class="container main3_box">
	<div class="row">
        <div class="ysbkbt col-xs-4">
            <div style="color:#282828; border-left:solid #ffbb50 3px;">精彩回顾</div>
        </div>
        <div class="youbian  col-xs-8">
            <div class="btn-group chaxun">
                <button type="button" class="btn btn-default dropdown-toggle "  data-toggle="dropdown">
                	<a href="javascript:void(0);" onclick="getPhotos();">查询</a>
                </button>               
            </div>
			<php>
				$matches = M('match')->select();
				$times = array();
				for($i=0;$i<count($matches);$i++){
					array_push($times, $matches[$i]['time']);
				}
				$times = array_unique($times);
			</php>
            <div class="btn-group xltb">
				<select style="background-color: white; height: 30px; width: 100px;" id="selectTime">
					<option value="" style="color: #b6b6b6" selected>比赛时间</option>
					<volist name="times" id="vo">
						<option value="{$vo}">{$vo}</option>
					</volist>
				</select>
            </div>
            <div class="btn-group xltb">
				<select style="background-color: white; height: 30px; width: 200px;" id="selectGame">
					<option value="" style="color: #b6b6b6" selected>比赛名称</option>
					<volist name="matches" id="vo">
						<option value="{$vo.name}">{$vo.name}</option>
					</volist>
				</select>
            </div>
        </div>
    </div>
</div>

<script>
	function getPhotos() {
		var selectTime = document.getElementById("selectTime");
		var time = selectTime.options[selectTime.selectedIndex].value;
		var selectGame = document.getElementById("selectGame");
		var game = selectGame.options[selectGame.selectedIndex].value;

		location.href = "__ROOT__/Portal/list/index?id=31&time="+time+"&game="+game;
	}
</script>

<php>

	$time = I('time');
	$game = I('game');
	if(!empty($time)){
		$where['m.time'] = $time;
	}
	if(!empty($game)){
		$where['m.name'] = $game;
	}

	$count=M('photo_wall')->alias('pw')->where($where)->join('left join hs_match as m on pw.match_id=m.id')->count();
	$p=getpage($count,24);
	$photos=M('photo_wall')->alias('pw')->where($where)->join('left join hs_match as m on pw.match_id=m.id')
	->order('pw.create_at desc')->limit($p->firstRow,$p->listRows)->select();
	$page=$p->show();
</php>
<php>
	function getpage($count,$pagesize=24) {
		$p=new \Think\Page($count,$pagesize);
		$p->setConfig('header','');
		$p->setConfig('prev','上一页');
		$p->setConfig('next','下一页');
		$p->setConfig('last','末页');
		$p->setConfig('first','首页');
		$p->setConfig('theme','%FIRST%&nbsp;%UP_PAGE%&nbsp;%LINK_PAGE%&nbsp;%DOWN_PAGE%&nbsp;%END%&nbsp;%HEADER%');
		$p->lastSuffix=false;
		return $p;
	}
</php>
<div class="container pbl_box">
			<div id="grid-gallery" class="grid-gallery pbl">
				<section class="grid-wrap">
					<ul class="grid">
						<li class="grid-sizer"></li><!-- for Masonry column width -->
						<volist name="photos" id="vo">
							<li>
								<figure>
									<img src="{:sp_get_image_preview_url($vo['url'])}"/>
								</figure>
							</li>
						</volist>
					</ul>
				</section><!-- // grid-wrap -->
				<section class="slideshow">
					<ul>
						<volist name="photos" id="vo">
							<li>
								<figure>
									<img src="{:sp_get_image_preview_url($vo['url'])}"/>
								</figure>
							</li>
						</volist>
					</ul>
					<nav>
						<span class="icon nav-prev"></span>
						<span class="icon nav-next"></span>
						<span class="icon nav-close"></span>
					</nav>
				</section><!-- // slideshow -->
				<div class="pages">
					{$page}
				</div>
			</div><!-- // grid-gallery -->
		</div>
		<script src="__TMPL__Portal/assets/js/imagesloaded.pkgd.min.js"></script>
		<script src="__TMPL__Portal/assets/js/masonry.pkgd.min.js"></script>
		<script src="__TMPL__Portal/assets/js/classie.js"></script>
		<script src="__TMPL__Portal/assets/js/cbpgridgallery.js"></script>

<!-- 代码 结束 -->
<script>
	new CBPGridGallery( document.getElementById( 'grid-gallery' ) );
</script>

<tc_include file="Portal:footer" />

</body>
</html>
